"use strict";

var timeProvider    = {};

timeProvider.dateTimestamp  = function() {
    var now = {};
    now.hrtime  =   process.hrtime();
    now.timestamp   =   parseInt(now.hrtime[0] * 1e3 + now.hrtime[1] * 1e-6);

    return now;
}

timeProvider.dateTimestampDiff  =   function(oTime) {
    var hrtime  = process.hrtime(oTime.hrtime);

    return parseInt(hrtime[0] * 1e3 + hrtime[1] * 1e-6);
}

timeProvider.nowTimestamp   =   function() {
    return process.uptime() * 1000;
}

timeProvider.diff   = function(oTime) {
    return process.uptime() * 1000 - oTime;
}

module.exports  = timeProvider;